import requests,pprint


def login(username,password):
    payload={
        'username':username,
        'password':password
    }
    r=requests.post("http://localhost/api/mgr/loginReq",data=payload)
    retobj = r.json()
    pprint.pprint(retobj)

    #获取状态码
    print(r.status_code)
    print(r.headers)

    #r.cookies[sessionid]直接可以打印sessionid
    print(r.cookies['sessionid'])
    return retobj,r.cookies
login('auto','sdfsdfsdf')